import requests

# 添加员工
resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/user/",
                     headers={"Content-Type": "application/json",
                              "Authorization": "e1438c1c-58e0-4efa-adb4-2db920768e43"},
                     json={
                         "username": "jack123",
                         "mobile": "13858037125",
                         "workNumber": "666"
                     })
print(resp.json())

# 查询员工
resp = requests.get(url="http://ihrm2-test.itheima.net/api/sys/user/1568891872846295040",
                    headers={"Authorization": "e1438c1c-58e0-4efa-adb4-2db920768e43"})
print(resp.json())

# 修改员工
resp = requests.put(url="http://ihrm2-test.itheima.net/api/sys/user/1568891872846295040",
                    headers={"Content-Type": "application/json",
                             "Authorization": "e1438c1c-58e0-4efa-adb4-2db920768e43"},
                    json={"username": "小猪佩奇"})
# 将 结果转换为 json，打印
print(resp.json())

# 删除员工
resp = requests.delete(url="http://ihrm2-test.itheima.net/api/sys/user/1568891872846295040",
                       headers={"Authorization": "ad7ebdd8-36ed-4c8d-b987-78097cecc4b4"})
# 将 结果转换为 json，打印
print(resp.json())
